/*******************************************************************************
 * Copyright (c) 2011 Gijs de Vries aka Janoz.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Gijs de Vries aka Janoz - initial API and implementation
 ******************************************************************************/
/* COPYRIGHT (C) 2008 Gijs de Vries. All Rights Reserved. */
package com.janoz.httpd;

/**
 * Enumeration of http return status codes.
 * 
 * @author Gijs de Vries
 *
 */
public enum StatusCode {
	OK (200, "OK"),
	REDIRECT (301, "Moved Permanently"),
	FORBIDDEN (403, "Forbidden"),
	NOTFOUND (404, "Not Found"),
	NOTALLOWED (405, "Method Not Allowed"), 
	BADREQUEST (400, "Bad Request"),
	INTERNALERROR (500, "Internal Server Error"),
	NOTIMPLEMENTED (501, "Not Implemented");
	
	private final int code;
	private final String message;
	/**
	 * 
	 * @param code numeric code of the status.
	 * @param message status message.
	 */
	StatusCode(int code, String message) {
		this.code = code;
		this.message = message;
	}
	/**
	 * Returns a string representation of the statuscode.
	 * @return the string representation
	 */
	@Override
	public String toString() {
		return code + " " + message;
	}
	
	public int getCode() {
		return code;
	}
}
